package com.liuyk.commonlib.network.request;

import java.util.HashMap;
import java.util.Map;

/**
 * 请求基本参数
 * <p>
 * Created by liuyakui on 2020/1/16.
 */
public abstract class BaseRequest {
    private final String url;

    public BaseRequest(String url) {
        this.url = url;
    }

    public Map<String, String> getParams() {
        final Map<String, String> params = new HashMap<>();
        final Map<String, String> builderParams = builderParams();
        if (builderParams != null) {
            params.putAll(builderParams);
        }
        return params;
    }

    public Map<String, String> getHeader() {
        return buildHeader();
    }

    public Map<String, String> buildHeader() {
        return new HashMap<>();
    }

    protected abstract Map<String, String> builderParams();

    public String getUrl() {
        return url;
    }

}
